<html>
<head><meta charset="utf-8"><title>lazy norm unused substs · project-const-generics · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/index.html">project-const-generics</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html">lazy norm unused substs</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="228079069"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228079069" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228079069">(Feb 27 2021 at 19:53)</a>:</h4>
<p>starting to look into the first approach outlined in the <a href="https://github.com/rust-lang/project-const-generics/blob/master/meetings/2021.02.16-lazy-norm.md">meeting</a> and will use this thread to write any thoughts I have about it</p>



<a name="228079115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228079115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228079115">(Feb 27 2021 at 19:54)</a>:</h4>
<p>as i can't control what i think about, here's my goal if we went with the second solution <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span> <a href="https://hackmd.io/NZ-VjSzqTImdY67dRRKQtQ">https://hackmd.io/NZ-VjSzqTImdY67dRRKQtQ</a></p>



<a name="228079166"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228079166" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228079166">(Feb 27 2021 at 19:55)</a>:</h4>
<p>so, the goal is to filter params and predicates eagerly</p>



<a name="228079218"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228079218" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228079218">(Feb 27 2021 at 19:56)</a>:</h4>
<p>what I don't yet fully know is when we want to do this <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="228079228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228079228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228079228">(Feb 27 2021 at 19:56)</a>:</h4>
<p>if we have</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">N</span>: <span class="kt">usize</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="n">N</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span><span class="p">]</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="fm">todo!</span><span class="p">()</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="228079232"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228079232" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228079232">(Feb 27 2021 at 19:56)</a>:</h4>
<p>we want the anon const to only depend on <code>N</code> and not on <code>T</code></p>



<a name="228079251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228079251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228079251">(Feb 27 2021 at 19:57)</a>:</h4>
<p>but after name resolution <code>N</code> is at index 1</p>



<a name="228079305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228079305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228079305">(Feb 27 2021 at 19:58)</a>:</h4>
<p>we won't be able to change this after hir building, so we would have to analyse all parent predicates before we built the hir afaict</p>



<a name="228080513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228080513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228080513">(Feb 27 2021 at 20:19)</a>:</h4>
<p>this feels like such a giant hack to do it during name res/mutating the name res results</p>



<a name="228089464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228089464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> jknodt <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228089464">(Feb 27 2021 at 23:12)</a>:</h4>
<p>er sorry if I'm missing something, but what's the specific issue with <code>N</code> being at index 1? Would it just be that we would have to scan to find the indices that are relevant?</p>



<a name="228089745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228089745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228089745">(Feb 27 2021 at 23:19)</a>:</h4>
<p>idk</p>



<a name="228089808"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228089808" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228089808">(Feb 27 2021 at 23:20)</a>:</h4>
<p>the question is what we do for the substs which are unused though</p>



<a name="228089890"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228089890" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228089890">(Feb 27 2021 at 23:22)</a>:</h4>
<p>i don't really have a mental model of how exactly this should work</p>



<a name="228089919"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228089919" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228089919">(Feb 27 2021 at 23:23)</a>:</h4>
<p>so <code>N</code> being at index <code>1</code> means that we can't just internally represent this as</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">const</span><span class="w"> </span><span class="n">ASSOC_CT</span><span class="o">&lt;</span><span class="k">const</span><span class="w"> </span><span class="n">N</span>: <span class="kt">usize</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">N</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span><span class="w"></span>
<span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">N</span>: <span class="kt">usize</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="n">ASSOC_CT</span>::<span class="o">&lt;</span><span class="n">N</span><span class="o">&gt;</span><span class="p">]</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="fm">todo!</span><span class="p">()</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="228089971"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228089971" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228089971">(Feb 27 2021 at 23:24)</a>:</h4>
<p>but instead something like</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">const</span><span class="w"> </span><span class="n">ASSOC_CT</span><span class="o">&lt;</span><span class="n">dont_care</span><span class="p">,</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">N</span>: <span class="kt">usize</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">N</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span><span class="w"></span>
<span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">N</span>: <span class="kt">usize</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="n">ASSOC_CT</span>::<span class="o">&lt;</span><span class="n">dummy_param</span><span class="p">,</span><span class="w"> </span><span class="n">N</span><span class="o">&gt;</span><span class="p">]</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="fm">todo!</span><span class="p">()</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="228090012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228090012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> jknodt <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228090012">(Feb 27 2021 at 23:26)</a>:</h4>
<p>What level of HIR/MIR is this here? can we not just keep a smallvec of "roots" which are indices into the generics which need to be traversed?</p>
<p>edit: by roots I mean the items named explicitly in the <code>AnonConst</code></p>



<a name="228090182"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228090182" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228090182">(Feb 27 2021 at 23:29)</a>:</h4>
<p>we have to do this before the hir is built</p>



<a name="228090499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228090499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> jknodt <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228090499">(Feb 27 2021 at 23:35)</a>:</h4>
<p>I'm still a bit confused, if we're just tracking the indices for a specific <code>AnonConst</code>, if we don't reoder the generics then isn't that fine?</p>



<a name="228091414"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228091414" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228091414">(Feb 27 2021 at 23:54)</a>:</h4>
<p>i am not sure what you mean with "just trakcing the indices"?</p>



<a name="228091507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228091507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228091507">(Feb 27 2021 at 23:56)</a>:</h4>
<p>or wait</p>



<a name="228091514"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228091514" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228091514">(Feb 27 2021 at 23:56)</a>:</h4>
<p>the actual assignment from <code>Param</code> to index happens far later and is based on <code>fn generics_of</code></p>



<a name="228091518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228091518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228091518">(Feb 27 2021 at 23:56)</a>:</h4>
<p>so that isn't actually a problem</p>



<a name="228091543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228091543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228091543">(Feb 27 2021 at 23:58)</a>:</h4>
<p>i am just confused in general</p>



<a name="228091586"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228091586" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228091586">(Feb 27 2021 at 23:58)</a>:</h4>
<p>i don't think we have to do this before building the hir? <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="228091595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228091595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228091595">(Feb 27 2021 at 23:58)</a>:</h4>
<p>we have to do it quite early, but during ast_lowering we don't create any <code>ty::Const</code> yet</p>



<a name="228091600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228091600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228091600">(Feb 27 2021 at 23:59)</a>:</h4>
<p>ok, that seems a bit better</p>



<a name="228091616"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228091616" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228091616">(Feb 27 2021 at 23:59)</a>:</h4>
<p>so i guess what I have to do is the following:</p>



<a name="228091625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228091625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228091625">(Feb 27 2021 at 23:59)</a>:</h4>
<ul>
<li>walk the hir of the anon const and collect all explicitly mentioned params</li>
</ul>



<a name="228091693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228091693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228091693">(Feb 28 2021 at 00:00)</a>:</h4>
<ul>
<li>somehow get the parent generics except that they must not mention our anon const yet</li>
</ul>



<a name="228091713"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228091713" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228091713">(Feb 28 2021 at 00:00)</a>:</h4>
<ul>
<li>compute the minimal reachable subset/transitive closure</li>
</ul>



<a name="228092095"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228092095" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> jknodt <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228092095">(Feb 28 2021 at 00:07)</a>:</h4>
<p>In this case, do we also have to consider cyclic types while walking? If we either encounter cyclic types or the original anon const then do we fail out?</p>



<a name="228092173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228092173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228092173">(Feb 28 2021 at 00:08)</a>:</h4>
<p>no, hir is a tree</p>



<a name="228092177"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228092177" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228092177">(Feb 28 2021 at 00:08)</a>:</h4>
<p>so we don't have to worry about loops</p>



<a name="228092213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228092213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> jknodt <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228092213">(Feb 28 2021 at 00:09)</a>:</h4>
<p>ah then they can't mention the original anon const?</p>



<a name="228092343"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228092343" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228092343">(Feb 28 2021 at 00:11)</a>:</h4>
<p>no</p>



<a name="228092347"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228092347" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228092347">(Feb 28 2021 at 00:11)</a>:</h4>
<p>anon consts can't be cyclic</p>



<a name="228092392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228092392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228092392">(Feb 28 2021 at 00:12)</a>:</h4>
<p>same as closures and generators</p>



<a name="228092450"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228092450" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> jknodt <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228092450">(Feb 28 2021 at 00:13)</a>:</h4>
<p>ah ok ok</p>



<a name="228092463"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228092463" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> jknodt <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228092463">(Feb 28 2021 at 00:13)</a>:</h4>
<p>is it difficult to get the parent generics excluding the anon const?</p>



<a name="228092478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228092478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228092478">(Feb 28 2021 at 00:13)</a>:</h4>
<p>idk</p>



<a name="228092516"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228092516" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228092516">(Feb 28 2021 at 00:14)</a>:</h4>
<p>it's kinda ugly</p>



<a name="228092532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228092532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228092532">(Feb 28 2021 at 00:14)</a>:</h4>
<p>cause i don't want to reimplement <code>gather_explicit_predicates_of</code></p>



<a name="228092567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228092567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228092567">(Feb 28 2021 at 00:15)</a>:</h4>
<p>maybe adding <code>ConstKind::Raw</code> which does not try to get the substs for anon consts</p>



<a name="228092569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228092569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228092569">(Feb 28 2021 at 00:15)</a>:</h4>
<p>and a <code>raw_predicates_of</code> query or something</p>



<a name="228092570"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228092570" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228092570">(Feb 28 2021 at 00:15)</a>:</h4>
<p>idk</p>



<a name="228092679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228092679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> jknodt <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228092679">(Feb 28 2021 at 00:17)</a>:</h4>
<p>yea I was just looking at the function and it's quite long and does many things lol</p>



<a name="228092849"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228092849" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> jknodt <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228092849">(Feb 28 2021 at 00:21)</a>:</h4>
<p>what is not included in <code>gather_explicit_predicates_of</code> that would be needed?</p>



<a name="228092905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228092905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228092905">(Feb 28 2021 at 00:22)</a>:</h4>
<p><code>gather_explicit_predicates_of</code> returns stuff which can contain our anon const as a <code>ty::ConstKind::Unevaluated</code></p>



<a name="228092914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228092914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> jknodt <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228092914">(Feb 28 2021 at 00:23)</a>:</h4>
<p>for a really cheap solution, can we just call it then filter it out by def id?</p>



<a name="228092920"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228092920" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228092920">(Feb 28 2021 at 00:23)</a>:</h4>
<p>and <code>ty::ConstKind::Unevaluated</code> needs to know how many and which substs are used for our cosntant</p>



<a name="228092931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228092931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228092931">(Feb 28 2021 at 00:23)</a>:</h4>
<p>no, cause even just calling <code>gather_explicit_predicates_of</code> causes a cycle</p>



<a name="228092973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228092973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228092973">(Feb 28 2021 at 00:24)</a>:</h4>
<p>"<span aria-label="cry" class="emoji emoji-1f622" role="img" title="cry">:cry:</span>" indeed</p>



<a name="228093079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228093079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> jknodt <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228093079">(Feb 28 2021 at 00:26)</a>:</h4>
<p>If there are multiple <code>ConstKind::Unevaluated</code>, are we ok gathering predicates with others?</p>



<a name="228093107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228093107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228093107">(Feb 28 2021 at 00:26)</a>:</h4>
<p>not exactly sure what you mean</p>



<a name="228093145"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228093145" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> jknodt <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228093145">(Feb 28 2021 at 00:27)</a>:</h4>
<p>I'm just wondering whether we can just omit all <code>ConstKind::Unevaluated</code> <a href="https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_typeck/collect.rs.html#2191">I think from here</a> or we need to include other AnonConsts</p>



<a name="228093198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228093198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228093198">(Feb 28 2021 at 00:28)</a>:</h4>
<p>these aren't the only ones</p>



<a name="228093207"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228093207" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228093207">(Feb 28 2021 at 00:28)</a>:</h4>
<p>any <code>ty::Ty</code> we create in that function</p>



<a name="228093209"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228093209" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228093209">(Feb 28 2021 at 00:28)</a>:</h4>
<p>can contain unevaluated anon consts</p>



<a name="228093227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228093227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228093227">(Feb 28 2021 at 00:29)</a>:</h4>
<p>for example in here: <a href="https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_typeck/collect.rs.html#2082">https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_typeck/collect.rs.html#2082</a></p>



<a name="228093304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/lazy%20norm%20unused%20substs/near/228093304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> jknodt <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/lazy.20norm.20unused.20substs.html#228093304">(Feb 28 2021 at 00:30)</a>:</h4>
<p>mmm I kind of see, that seems annoying</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>